package com.zdb.demo.design.pattern.structural.composite;

public class Course extends CatalogComponent {

    private String name;
    private double price;

    public Course(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getPrice() {
        return price;
    }

    @Override
    public void print() {
        System.out.println("课程：" + name);
    }

    @Override
    protected void printByLevel(int level) {
        printN("+", level);
        print();
    }
}
